package com.hzit;

import com.hzit.config.MyConfig;
import com.hzit.config.Pet;
import com.hzit.config.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@SpringBootApplication
public class SpringBootApplication03 {
	public static void main(String[] args) {
		ConfigurableApplicationContext run = SpringApplication.run(SpringBootApplication03.class, args);
		// String[] beanDefinitionNames = run.getBeanDefinitionNames();
		// for (String definitionName : beanDefinitionNames) {
		// 	System.out.println(definitionName);
		// }

		MyConfig bean = run.getBean(MyConfig.class);
		User user01 = bean.user01();
		User user02 = bean.user01();
		System.out.println("user01 = " + user01);
		System.out.println("user02 = " + user02);

		Pet pet01 = user01.getPet();
		Pet pet02 = user02.getPet();
		System.out.println("pet01 = " + pet01);
		System.out.println("pet02 = " + pet02);
	}


}
